package com.java.tutorials.jdk7.paths;

import java.nio.file.FileSystems;
import java.nio.file.Path;

/**
 * Created by xuzhike on 2016/1/27.
 * http://www.java2s.com/Code/Java/JDK-7/Getthefolderdirectoryforeachpartofafullpath.htm
 * Get the folder/directory for each part of a full path
 */
public class Getthefolderdirectoryforeachpartofafullpath {
    public static void main(String[] args) {
        Path path = FileSystems.getDefault().getPath("/home/docs/status.txt");
        System.out.printf("getNameCount: %d\n", path.getNameCount());
        for (int index = 0; index < path.getNameCount(); index++) {
            System.out.printf("getName(%d): %s\n", index, path.getName(index));
        }
    }
}
